import React from 'react';
import { Text, TouchableOpacity, StyleSheet } from 'react-native';
const Todo = ({ onPress, completed, text, onRemove }) => (
  <>
    <TouchableOpacity onPress={onPress}>
      <Text style={completed ? styles.red : styles.blue}>
        {text} {completed ? 'completed' : 'not completed'}
      </Text>
    </TouchableOpacity>
    <TouchableOpacity onPress={onRemove} style={styles.marginLeft}>
      <Text>删除</Text>
    </TouchableOpacity>
  </>
);

const styles = StyleSheet.create({
  red: {
    color: 'red',
  },
  blue: {
    color: 'blue',
  },
  marginLeft: {
    marginLeft: 30,
  },
});
export default Todo;
